<!DOCTYPE html>
<html>
<head>
  <title></title>
</head>
<body>
<div id="app">
  <!-- <form @submit="handleSubmit">
    <h2>不使用修饰符时</h2>
    <button type="submit">提交</button>
  </form> -->
  <form @submit.prevent="handleSubmit">
    <h2>使用.prevent修饰符时</h2>
    <button type="submit">提交</button>
  </form>
</div>
<script src="https://cdn.jsdelivr.net/npm/vue@2.5.16/dist/vue.min.js"></script>
<script type="text/javascript">
  let vm = new Vue({
    el: '#app',
    data () {
      return {
        counter: 0
      }
    },
    methods: {
      handleSubmit () {
        console.log(`submit ${++this.counter} times`)
      }
    }
  })
</script>
</body>
</html>